package cn.lanqiao.bigDate.mapper.sys;

import cn.lanqiao.bigDate.entity.sys.SysArea;
import cn.lanqiao.bigDate.entity.sys.SysDept;
import cn.lanqiao.bigDate.entity.sys.SysRole;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.sql.ResultSet;
import java.util.List;

/**
 * @description 区域表Mapper
 * @author yang
 * @date 2022-03-13
 */
@Mapper
public interface SysAreaMapper extends BaseMapper<SysArea> {
    @Select(
            "<script>select t0.* from sys_role t0 " +
                    //add here if need left join
                    "where 1=1" +
                    "<when test='id!=null and id!=&apos;&apos; '> and t0.id=#{id}</when> " +
                    "<when test='roleName!=null and roleName!=&apos;&apos; '> and t0.role_name=#{roleName}</when> " +
                    "<when test='createBy!=null and createBy!=&apos;&apos; '> and t0.create_by=#{createBy}</when> " +
                    "<when test='createTime!=null and createTime!=&apos;&apos; '> and t0.create_time=#{createTime}</when> " +
                    "<when test='updateBy!=null and updateBy!=&apos;&apos; '> and t0.update_by=#{updateBy}</when> " +
                    "<when test='updateTime!=null and updateTime!=&apos;&apos; '> and t0.update_time=#{updateTime}</when> " +
                    "<when test='remark!=null and remark!=&apos;&apos; '> and t0.remark=#{remark}</when> " +
                    //add here if need page limit
                    //" limit ${page},${limit} " +
                    " </script>")
    List<SysRole> pageAll(SysRole queryParamDTO, int page, int limit);

    @Select("<script>select count(1) from sys_role t0 " +
            //add here if need left join
            "where 1=1" +
            "<when test='id!=null and id!=&apos;&apos; '> and t0.id=#{id}</when> " +
            "<when test='roleName!=null and roleName!=&apos;&apos; '> and t0.role_name=#{roleName}</when> " +
            "<when test='createBy!=null and createBy!=&apos;&apos; '> and t0.create_by=#{createBy}</when> " +
            "<when test='createTime!=null and createTime!=&apos;&apos; '> and t0.create_time=#{createTime}</when> " +
            "<when test='updateBy!=null and updateBy!=&apos;&apos; '> and t0.update_by=#{updateBy}</when> " +
            "<when test='updateTime!=null and updateTime!=&apos;&apos; '> and t0.update_time=#{updateTime}</when> " +
            "<when test='remark!=null and remark!=&apos;&apos; '> and t0.remark=#{remark}</when> " +
            " </script>")
    int countAll(SysRole queryParamDTO);

}
